1. Field of the Invention
The present invention relates to an image processing method and an image processing apparatus for carrying out color balance adjustment processing on an image obtained by using a digital camera when the image is output from a printer or the like, and also relates to a computer-readable recording medium storing a program to cause a computer to execute the image processing method.
2. Description of the Related Art
In a digital electronic still camera (hereinafter called a digital camera), an image obtained by photographing is recorded as digital image data in a recording medium such as an IC card or a built-in memory installed in the digital camera. Based on the digital image data having been recorded, the photographed image can be reproduced as a hard copy such as a print or a soft copy on a display device. When an image obtained by a digital camera is reproduced as has been described above, the image is expected to have as high a quality as a photograph printed from a negative film.
Meanwhile, human vision has a mechanism called chromatic adaptation for perceiving white paper as white not as bluish or reddish even in daylight or in light from a fluorescent lamp or a tungsten light each having a different spectrum energy distribution from normal daylight. Taking such chromatic adaptation into consideration, a digital camera having a function (an AWB function) has been proposed for carrying out automatic white balance adjustment processing (AWB processing) in accordance with a light source used at the time of photographing on original image data representing a photographed image so as to obtain an image not depending on a color of the light source such as tungsten light, light from a fluorescent lamp, or daylight.
Furthermore, a digital camera for outputting image data after image processing such as chroma enhancing processing on the image data so as to cause a color to become adequate when displayed on a CRT monitor has been known, since image data obtained by a digital camera are frequently displayed on a CRT monitor.
Meanwhile, when image data obtained by a digital camera are output as a hard copy from a printer or the like, the printer carries out AWB processing adequate for printing on the image data and the image data after the processing are printed.
Due to limitation caused by processing speed or hardware, the AWB processing carried out in a digital camera is comparatively simple processing for adjusting a gain of each color by equalizing averages of RGB colors, assuming an average of all pixel values being gray. Meanwhile, a printer can carry out more sophisticated AWB processing than that of a digital camera. For example, as has been described in Japanese Patent Application No. 11(1999)-70186, RGB values of each pixel are converted into chromaticity values to find averages of the chromaticity values. The averages are then converted into physiological primary colors and assumed to be a neutral point of a light source used at the time of photographing. The chromaticity values are converted so as to cause the physiological primary colors to be equal to physiological primary colors of a reference light source for photographing. The converted chromaticity values are then converted into RGB signals.
However, since image data output from a digital camera have been subjected to AWB processing, colors look different from colors in an original image. Therefore, for image data obtained by a digital camera, the function of sophisticated AWB processing carried out by a printer is not fully used. In the case where the digital camera carries out image processing such as chroma enhancing processing as well as the AWB processing, image data obtained by the digital camera have distorted color balance. As a result, regardless of sophisticated AWB processing carried out on the image data, an adequate neutral point cannot be set and a high quality image cannot be obtained.
The present invention has been conceived based on consideration of the above problems. An object of the present invention is therefore to provide an image processing method and an image processing apparatus for carrying out adequate color balance adjustment processing such as AWB processing on image data obtained by a digital camera, and also to provide a computer-readable recording medium storing a program to cause a computer to execute the image processing method.
A first image processing method of the present invention is a method of obtaining color-balance adjusted image data by carrying out color balance adjustment processing on white-balance adjusted image data obtained by carrying out, on original image data, white balance adjustment processing using gain adjustment in a color space in which the original image data have been obtained. The image processing method comprises the steps of:
obtaining inverse white-balance adjusted image data by carrying out, on the white-balance adjusted image data, inverse white balance adjustment processing which is inverse processing of the white balance adjustment processing; and
obtaining the color-balance adjusted image data by carrying out the color balance adjustment processing on the inverse white-balance adjusted image data.
The xe2x80x9coriginal image dataxe2x80x9d refer to image data before the white balance adjustment processing. Not only image data immediately after photographing by a digital camera but also image data after any processing, such as image data after standardization processing, can be used as the original image data, as long as the white balance adjustment processing has not been carried out.
The xe2x80x9ccolor space in which the original image data have been obtainedxe2x80x9d means a color space of a sensor such as CCDs installed in the digital camera used for obtaining the original image data. For example, an RGB color space or a CMY color space can be used.
The xe2x80x9cwhite balance adjustment processing using gain adjustment in a color space in which the original image data have been obtainedxe2x80x9d refers to processing for adjusting a gain of each color in the color space of the sensor for obtaining the original image data such as the RGB color space and the CMY color space so that a difference between neutral points depending on a light source used upon viewing the original image data and on a light source used at the time of photographing can be corrected.
The xe2x80x9ccolor balance adjustment processingxe2x80x9d refers to processing for correcting the difference between the neutral points depending on the light source used at the time of photographing an image and viewing the image. For example, comparatively sophisticated processing such as the processing described in Japanese Patent Application No. 11(1999)-70186 is an example of the color balance adjustment processing.
The xe2x80x9cinverse white balance adjustment processing which is inverse processing of the white balance adjustment processingxe2x80x9d means processing for restoring the white-balance adjusted image data to the original image data. Precisely speaking, the xe2x80x9cinverse white-balance adjusted image dataxe2x80x9d obtained by carrying out the inverse white balance adjustment processing are not exactly the same as the original image data immediately after photographing, due to a calculation error or clipping. However, the inverse white-balance adjusted image data can be regarded as the original image data immediately after photographing.
In the first image processing method of the present invention, it is preferable for the inverse white balance adjustment processing to be carried out on the white-balance adjusted image data, based on information when carrying out the white balance adjustment processing.
As the xe2x80x9cinformation when carrying out the white balance adjustment processingxe2x80x9d, parameters such as the gain of each color adjusted during the white balance processing can be used, for example.
As the xe2x80x9cpredetermined image processingxe2x80x9d, color conversion processing for enhancing chroma or density conversion processing for converting density of a scene can be used, for example.
A second image processing method of the present invention is an image processing method for obtaining color-balance adjusted image data by carrying out color balance adjustment processing on white-balance adjusted image data obtained by carrying out white balance adjustment processing on original image data by using gain adjustment in a color space in which the original image data have been obtained and by carrying out predetermined image processing thereon. The image processing method comprises the steps of:
obtaining inverse white-balance adjusted image data by carrying out, on the white-balance adjusted image data, inverse image processing which is inverse processing of the predetermined image processing and inverse white balance adjustment processing which is inverse processing of the white balance adjustment processing; and
obtaining the color-balance adjusted image data by carrying out the color balance adjustment processing on the inverse white-balance adjusted image data.
In the second image processing method of the present invention, it is preferable for the inverse white balance adjustment processing to be carried out on the white-balance adjusted image data, based on information when carrying out the white balance adjustment processing.
In the second image processing method of the present invention, it is preferable for the inverse image processing to be carried out on the white-balance adjusted image data, based on information when carrying out the predetermined image processing.
As the xe2x80x9cinformation when carrying out the predetermined image processingxe2x80x9d, information representing the amount of colors or tones changed by the predetermined image processing can be used. More specifically, in the case where the predetermined image processing is density conversion processing or color conversion processing for enhancing chroma, information representing the amount of chroma or density having been changed through the processing can be used.
A first image processing apparatus of the present invention is an apparatus for obtaining color-balance adjusted image data by carrying out color balance adjustment processing on white-balance adjusted image data obtained by carrying out, on original image data, white balance adjustment processing using gain adjustment in a color space in which the original image data have been obtained. The image processing apparatus comprises:
inverse processing means for obtaining inverse white-balance adjusted image data by carrying out, on the white-balance adjusted image data, inverse white balance adjustment processing which is inverse processing of the white balance adjustment processing; and
color balance adjustment processing means for obtaining the color-balance adjusted image data by carrying out the color balance adjustment processing on the inverse white-balance adjusted image data.
In the first image processing apparatus of the present invention, it is preferable for the inverse processing means to carry out the inverse white balance adjustment processing on the white-balance adjusted image data, based on information when carrying out the white balance adjustment processing.
A second image processing apparatus of the present invention is an apparatus for obtaining color-balance adjusted image data by carrying out color balance adjustment processing on white-balance adjusted image data obtained by carrying out, on original image data, white balance adjustment processing using gain adjustment in a color space in which the original image data have been obtained and by carrying out predetermined image processing thereon. The image processing apparatus comprises:
inverse processing means for obtaining inverse white-balance adjusted image data by carrying out, on the white-balance adjusted image data, inverse image processing which is inverse processing of the predetermined image processing and inverse white balance adjustment processing which is inverse processing of the white balance adjustment processing; and
color balance adjustment processing means for obtaining the color-balance adjusted image data by carrying out the color balance adjustment processing on the inverse white-balance adjusted image data.
In the second image processing apparatus of the present invention, it is preferable for the inverse processing means to carry out the inverse white balance adjustment processing on the white-balance adjusted image data, based on information when carrying out the white balance adjustment processing.
Furthermore, in the second image processing apparatus of the present invention, it is preferable for the inverse processing means to carry out the inverse image processing on the white-balance adjusted image data, based on information when carrying out the predetermined image processing.
The first image processing method and the second image processing method of the present invention may be provided as programs stored in a computer-readable recording medium to cause a computer to execute the methods.
Furthermore, the first image processing apparatus and the second image processing apparatus may be installed in an output apparatus such as a printer.
According to the present invention, the inverse white-balance adjusted image data are obtained by carrying out the inverse white balance adjustment processing on the white-balance adjusted image data, and the inverse white-balance adjusted image data are subjected to the color balance adjustment processing. Therefore, the color-balance adjusted image data obtained in this manner can be regarded as image data having a color balance almost the same as the color balance obtained by carrying out color balance adjustment processing directly on the original image data. Consequently, the color-balance adjusted image data sufficiently reflecting processing performance of color balance adjustment processing can be obtained without being affected by white balance adjustment processing.
In the case where the white-balance adjusted image data have been subjected to the white balance adjustment processing and the predetermined image processing, the inverse white-balance adjusted image data are obtained by carrying out the inverse image processing which is the inverse processing of the predetermined image processing and the inverse white balance adjustment processing on the white-balance adjusted image data. By carrying out the color balance adjustment processing on the inverse white-balance adjusted image data, the color-balance adjusted image data are obtained. Therefore, the color-balance adjusted image data obtained in this manner have been subjected to color balance adjustment processing almost the same as in the case of carrying out direct color balance processing on the original image data. Consequently, processing can be carried out on inverse white-balance adjusted image data which can be regarded as the original image data and have less affected color balance than in the case of carrying out the color balance adjustment processing on the white-balance adjusted image data. In this manner, the color-balance adjusted image data sufficiently reflecting processing performance of the color balance adjustment processing can be obtained by adequately setting a neutral point, without being affected by the white balance adjustment processing and by the predetermined image processing.